from DataManagement.models import DataCenterModel
from gxdm.models import *
from DataCenter.code import Code
from django.db import models


class Gxjg0101(DataCenterModel):
    class Meta(DataCenterModel.Meta):
        db_table = 'gxjg0101'
        verbose_name = 'GXJG0101 教师信息'
        verbose_name_plural = 'GXJG0101 教师信息'

    gh = models.CharField("工号", max_length=32, unique=True, primary_key=True)
    # gkdwh = models.CharField("挂靠单位", max_length=5, choices=Code.DEPARTMENT_CHOICE, blank=True, null=True, help_text='当人事关系不在工作单位时填写')
    gkdwh = models.ForeignKey(Dwbmdm, to_field='value', related_name='gkdwh_set', null=True, blank=True, on_delete=models.PROTECT, db_column='gkdwh', verbose_name="挂靠单位", help_text='当人事关系不在工作单位时填写')
    # dwh = models.CharField("单位", max_length=5, choices=Code.DEPARTMENT_CHOICE, blank=True, null=True)
    dwh = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_set', on_delete=models.PROTECT, db_column='dwh', verbose_name="单位", blank=True, null=True)
    dwh_1 = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_1_set', on_delete=models.PROTECT, db_column='dwh_1', verbose_name="挂职单位1", blank=True, null=True)
    dwh_2 = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_2_set', on_delete=models.PROTECT, db_column='dwh_2', verbose_name="挂职单位2", blank=True, null=True)
    dwh_3 = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_3_set', on_delete=models.PROTECT, db_column='dwh_3', verbose_name="挂职单位3", blank=True, null=True)
    dwh_4 = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_4_set', on_delete=models.PROTECT, db_column='dwh_4', verbose_name="挂职单位4", blank=True, null=True)
    dwh_5 = models.ForeignKey(Dwbmdm, to_field='value', related_name='dwh_5_set', on_delete=models.PROTECT, db_column='dwh_5', verbose_name="挂职单位5", blank=True, null=True)
    xm = models.CharField("姓名", max_length=128)
    ywxm = models.CharField("英文姓名", max_length=128, blank=True, null=True)
    xmpy = models.CharField("姓名拼音", max_length=128, blank=True, null=True)
    cym = models.CharField("曾用名", max_length=128, blank=True, null=True)
    # xbm = models.CharField("性别", max_length=1, choices=Code.SEX_CHOICE, blank=True, null=True)
    xbm = models.ForeignKey(Xbdm, to_field='value', on_delete=models.PROTECT, related_name='xbm', db_column='xbm', verbose_name='性别')
    csrq = models.DateField("出生日期", max_length=32, blank=True, null=True)
    csd = models.CharField("出生地", max_length=64, blank=True, null=True)
    csdm = models.CharField("出生地码", max_length=32, choices=Code.XZQY_CHOICE, blank=True, null=True)
    jg = models.CharField("籍贯", max_length=32, blank=True, null=True)
    # mzm = models.CharField("民族", max_length=32, blank=True, null=True)
    mzm = models.ForeignKey(Mzdm, to_field='value', on_delete=models.PROTECT, db_column='mzm', verbose_name='民族', blank=True, null=True)
    gjdqm = models.CharField("国籍/地区", max_length=128, blank=True, null=True)
    sfzjlxm = models.ForeignKey(Sfzjlxdm, to_field='value', on_delete=models.PROTECT, db_column='sfzjlxm', verbose_name="身份证件类型", blank=True, null=True)
    sfzjh = models.CharField("身份证件号", max_length=32)
    hyzkm = models.CharField("婚姻状况", max_length=32, choices=Code.HYZKM_CHOICE, blank=True, null=True)
    gatqwm = models.CharField("港澳台侨外", max_length=2, choices=Code.GATQWM_CHOICE, blank=True, null=True)
    zzmm = models.CharField("政治面貌", max_length=64, blank=True, null=True)
    zzmmm = models.ForeignKey(Zzmmdm, to_field='value', on_delete=models.PROTECT, db_column='zzmmm', verbose_name='政治面貌码', blank=True, null=True)
    jkzkm = models.CharField("健康状况", max_length=32, choices=Code.JKZKM_CHOICE, blank=True, null=True)
    xyzjm = models.CharField("信仰宗教", max_length=32, blank=True, null=True)
    xxm = models.CharField("血型", max_length=32, choices=Code.BLOOD_TYPE_CHOICE, blank=True, null=True)
    # zp = models.CharField("照片", max_length=128, blank=True, null=True)
    zp = models.CharField("照片", max_length=128, blank=True, null=True)
    sfzjyxq = models.DateField("身份证件有效期", blank=True, null=True)
    xqm = models.CharField("校区", max_length=32, choices=Code.CAMPUS_CHOICE, blank=True, null=True)
    zgxl = models.CharField("最高学历", max_length=64, blank=True, null=True)
    # zgxlm = models.CharField("最高学历码", max_length=32, choices=Code.XL_CHOICE, blank=True, null=True)
    zgxw = models.CharField("最高学位", max_length=64, blank=True, null=True)
    # zgxwm = models.CharField("最高学位码", max_length=32, blank=True, null=True)
    # whcdm = models.CharField("文化程度", max_length=32, blank=True, null=True)
    cjgzny = models.DateField("参加工作年月", max_length=32, blank=True, null=True)
    lxrq = models.DateField("来校日期", max_length=32, blank=True, null=True)
    qxrq = models.DateField("起薪日期", max_length=32, blank=True, null=True)
    cjny = models.DateField("从教年月", max_length=32, blank=True, null=True)
    bzlbm = models.CharField("编制类别", max_length=32, choices=Code.BZLB_CHOICE, blank=True, null=True)
    # jzglbm = models.CharField("教职工类别", max_length=2, choices=Code.JZGLBM_CHOICE, blank=True, null=True)
    jzglbm = models.ForeignKey(Jzglbdm, to_field='value', on_delete=models.PROTECT, db_column='jzglbm', verbose_name='教职工类别', blank=True, null=True)
    dabh = models.CharField("档案编号", max_length=32, blank=True, null=True)
    dawb = models.CharField("档案文本", max_length=32, blank=True, null=True)
    dqztm = models.CharField("当前状态", max_length=32, choices=Code.TEACHER_STATUS_CHOICE, default='1')
    tc = models.CharField("特长", max_length=32, blank=True, null=True)
    xklbm = models.CharField("学科类别", max_length=32, blank=True, null=True)
    yjxkm = models.CharField("一级学科", max_length=32, blank=True, null=True)
    ejxkm = models.CharField("二级学科", max_length=32, blank=True, null=True)
    yjfx = models.CharField("研究方向", max_length=32, blank=True, null=True)
    type = models.IntegerField('类型', choices=Code.TEACHER_TYPE_CHOICE, blank=True, null=True)
    zc = models.CharField("职称", max_length=32, blank=True, null=True)
    zcjb = models.CharField("职称级别", max_length=32, choices=Code.ZCJB_CHOICE, blank=True, null=True)
    zj = models.CharField("职级", max_length=33, choices=Code.ZJ_CHOICE, blank=True, null=True)
    yrxs = models.CharField("用人形式", max_length=64, blank=True, null=True)
    openoa = models.CharField("是否开通OA", max_length=10,choices=Code.OPENOA_CHOICE, blank=True, null=True)

    def __str__(self):
        return self.xm